//
//  QCSetupTopCell.swift
//  爱汽车
//
//  Created by tucici on 2023/8/27.
//

import UIKit
var QCSetupTopCellH = 0.0
class QCSetupTopCell: UITableViewCell {
    @IBOutlet var bgView: UIView!
    @IBOutlet var logo: UIImageView!
    @IBOutlet var logoTop: NSLayoutConstraint!
    lazy var setupView:QCSetupView = {
        let view = QCSetupView.loadFromXIB() as! QCSetupView
        bgView.addSubview(view)
        return view
    }()
    override func awakeFromNib() {
        super.awakeFromNib()
        initUI()
    }
    func initUI(){
        switch setupView.style{
        case .normal:
            logo.isHidden = false
            logoTop.constant = 24
            setupView.snp.remakeConstraints { make in
                make.left.right.equalToSuperview().inset(0)
                make.bottom.equalToSuperview().inset(0)
                make.top.equalTo(logo.snp.bottom).offset(20)
                //                    make.height.equalTo(436)
            }
        case .custom:
            logo.isHidden = true
            logoTop.constant = 0
            setupView.snp.remakeConstraints { make in
                make.left.right.equalToSuperview().inset(0)
                make.bottom.equalToSuperview().inset(0)
                make.top.equalToSuperview().offset(20)
                // make.height.equalTo(336)
            }
        default:
            break
        }
    }
    
    
    var bytes = [UInt8](){
        didSet{
            guard bytes.count >= 8 else{return}
            setupView.bytes = bytes
        }
    }
}
